{include file="common/head"}
<head>
<title>收付款审核</title>
    <style type="text/css">
        input{display:initial!important;}
    </style>    
</head>
<body >

    <div class="container-fluid " >

    <div class="row">
        <div class="col-2" style="text-align: left;line-height: 50px;font-size: 2rem;" >
            收付款审核
        </div>
        <div class="col-10">
        <form action="/index.php/acc/charge_check" method="post">
            <div class="row" id="query_bar" style="height: 50px;line-height: 50px;">
                <div class="col">

                <label for="name" >姓名：</label>
                <input class="form-control" type="text"  id="name" name="name" value="{$name}" placeholder="姓名" />
                <label for="mobile" >手机：</label>
                <input class="form-control" type="text"  id="mobile" name="mobile" value="{$mobile}" placeholder="手机号码" />
                <button type="button" class="btn btn-warning query" style="vertical-align: middle;" >
                    <span class="bi-search" ></span>
                </button>
            
                </div>

            </div>
        </form>

        </div>
    </div>

      <table class="table table-sm table-striped">
        <thead>
            <th>序号</th>
            <th>类型</th>
            <th>客户</th>
            <th>金额</th>
            <th>支付方式</th>
            <th>款项备注</th>
            <th>录入人</th>
            <th>日期</th>
            <th>状态</th>
            <th>
            </th>
        </thead>
        <tbody>
          {foreach $list['data'] as $k=>$log}
          <tr>
            <td>{$k+1}</td>
            <td>{$log['type_name']}</td>
            <td>{$log['customer_id_name']}</td>
            <td style="color:{if $log['money']<0} red;{/if}">{$log['money']}</td>
            <td>{$log['payment_name']}</td>            
            <td>{$log['memo']}</td>
            <td>{$log['creater_name']}</td>
            <td>{$log['create_time']}</td>
            <td>{$log['status_name']}</td>
            <td>
                {if $log['status']==1}
                <button class="btn btn-sm btn-primary check_ok" acc_id="{$log['id']}" status="2"><span class="bi-check" title="通过"></span></button>
                <button class="btn btn-sm btn-warning check_cancel" acc_id="{$log['id']}" status="4"><span class="bi-trash" title="取消"></span></button>
                {/if}
            </td>
          </tr>
          {/foreach}
        </tbody>
      </table>
    {include file="common/pagination"}
    </div>

<script type="text/javascript">


  $(document).ready(function(){
    $(".query").on('click',function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2

        $("form").submit();
        layer.close(index);
    }) 


    $(".check_ok,.check_cancel").on('click',function(){
            var acc_id=$(this).attr('acc_id');
            var status = $(this).attr('status');
            var msg = (status==2) ? '【收款】请确认到账情况，【付款】请确认已打款！':'是否确认取消此笔款项？';

            layer.confirm(msg, {title:'操作确认',
              btn: ['Yes','No'] //按钮
            }, function(){
                //submit order
                $.post('/index.php/acc/charge_check',{
                    id:acc_id,status:status
                },function(res){
                    var res =JSON.parse(res);
                    console.log(res.msg);
                    layer.msg(res.msg,function(){location.reload()});

                })  

            }, function(){
                // layer.msg('yes!');
                //  return false;
            });
    })
  })


  




</script>


</body>
</html>
